package com.jason.mvptest.implement.login;

import com.jason.mvptest.bean.User;

/**
 * 去实现userloginevent的接口方法 处理请求逻辑 以及一些接口回调
 * @Author: Jason
 * @Date: 2016/11/10
 * @Time: 16:13.
 */

public class UserLoginEvent implements IUserLonginEvent {

    @Override
    public void login(final String username, final String password, final ClickLoginListener clickLoginListener) {

        new Thread(new Runnable() {
            @Override
            public void run() {

                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                if ("jason".equals(username) && "123".equals(password)) {
                    clickLoginListener.loginSusscess(new User(username, password));
                } else {
                    clickLoginListener.loginFaild();
                }


            }
        }).start();

    }
}
